package edu.aysf.service.impl;

import edu.aysf.dao.AccountDao;
import edu.aysf.entity.AccountEntity;
import edu.aysf.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class AccountServiceImpl implements AccountService {

    @Autowired
    private AccountDao accountDao;

    // 新增账户
    @Override
    public int createAccount(int id, int user_id, String source,float money) {
        return accountDao.createAccount(id, user_id, source, money);
    }

    // 查询所有账户
    @Override
    public List<AccountEntity> selectAccount() {
        return accountDao.selectAccount();
    }

    // 查询指定账户，根据id
    @Override
    public List<AccountEntity> selectAccountById(int id) {
        return accountDao.selectAccountById(id);
    }

    @Override
    public float selectMoney(int user_id) {
        return accountDao.selectMoney(user_id);
    }

    // 更新账户
    @Override
    public int updateAccount(int user_id, float user_money) {
        return accountDao.updateAccount(user_id,user_money);
    }

    @Override
    public int deleteAccount(int id) {
        return accountDao.deleteAccount(id);
    }
}
